package com.ruanjian.api.controller;

import com.ruanjian.api.bean.ExperimentStage;
import com.ruanjian.api.utils.AjaxResult;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @author shkstart
 * @create 2022-11-23 12:14
 */
@Api(tags = "阶段接口")
@Slf4j
@RestController
@RequestMapping("/api/java/ExperimentStage")
public class ExperimentStageController extends BaseController{

    /**
     * 根据用户id查询阶段信息
     * @param userId 用户id
     * @return
     */
    @CrossOrigin
    @GetMapping("/listExperimentStageByUserId/{userId}")
    public AjaxResult listExperimentStageByUserId(@PathVariable("userId") Long userId){
        return AjaxResult.success().add("ExperimentStage",stageService.listExperimentStageByUserId(userId));
    }

    /**
     * 更新阶段用时
     * @param stage
     * @return
     */
    @CrossOrigin
    @PostMapping("/updateSelective")
    public AjaxResult updateSelective(@RequestBody ExperimentStage stage){
        return AjaxResult.success().add( "updateSelective" ,stageService.updateSelective(stage) );
    }

}
